package com.ccq.util;

import com.ccq.ResultEum;
import com.ccq.domain.Result;

public class ResultUtil {
	public static <T> Result<T> success(T t){
		Result<T> r=new Result<T>();
		r.setCode(ResultEum.Success.getCode());
		r.setMsg(ResultEum.Success.getMsg());
		r.setData(t);
		return r;
	}
	public static <T> Result<T> erro(T t){
		Result<T> r=new Result<T>();
		r.setCode(ResultEum.Erro.getCode());
		r.setMsg(ResultEum.Erro.getMsg());
		r.setData(t);
		return r;
	}
	
	public static <T> Result<T> unKnow(T t){
		Result<T> r=new Result<T>();
		r.setCode(ResultEum.UnknownError.getCode());
		r.setMsg(ResultEum.UnknownError.getMsg());
		r.setData(null);
		return r;
	}
}
